package com.wealth.scsj.b_app.presenter;

import android.util.Log;

import com.wealth.scsj.b_app.base.GetOrderIncomeAndOrderQuantityBase;
import com.wealth.scsj.b_app.base.SettleAmountSumForDeliveryBase;
import com.wealth.scsj.b_app.bean.SettleAmountSumForDeliveryBean;
import com.wealth.scsj.b_app.bean.StoreOperationMainBean;
import com.wealth.scsj.b_app.model.GetOrderIncomeAndOrderQuantityModel;
import com.wealth.scsj.b_app.model.SettleAmountSumForDeliveryModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 我的钱包-- 获取预计收益
 */

public class SettleAmountSumForDeliveryPresenter extends BasePresenter implements SettleAmountSumForDeliveryBase.IPresenter {

    private SettleAmountSumForDeliveryBase.IModel mModel;
    private SettleAmountSumForDeliveryBase.IView mView;

    public SettleAmountSumForDeliveryPresenter(SettleAmountSumForDeliveryBase.IView view) {
        mView = view;
        mModel = new SettleAmountSumForDeliveryModel();
    }

    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getSettleAmountSumForDelivery(requestBody, new ResponseCallback<SettleAmountSumForDeliveryBean>() {
            @Override
            public void onSuccess(SettleAmountSumForDeliveryBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("获取订单量和订单收入成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取订单量和订单收入失败", msg + "");
            }
        }));
    }
}
